/*
 *  ETInitScene.cpp
 *  EidoTron
 *
 *  Created by Luca Di Franco on 31/03/11.
 *  Copyright 2011 Luca Di Franco. All rights reserved.
 *
 */

#include "EidoTronApp.h"

#include "../Scene_organization/CollisionManager.h"
#include "../Scene_organization/SceneNode.h"
#include "../Entities/Camera.h"
#include "../Entities/RedCycle.h"
#include "../Entities/GreenCycle.h"
#include "../Entities/BlueCycle.h"
#include "../Scene_organization/BoundingSphere.h"
#include "../Entities/Battleground.h"


void EidoTronApp::initScene()
{	
	redCycle = SceneNode::getRootSceneNode()->createChild(new RedCycle());
	((BOEntity*)redCycle->data)->generateBufferObjects();
	redCycle->memRotate(180.0f, 0.0f, 1.0f, 0.0f);
	redCycle->memTranslate(1.0f, 0.0f, 0.0f);
	
	greenCycle = SceneNode::getRootSceneNode()->createChildPlayerNode(new GreenCycle());
	((BOEntity*)(greenCycle->data))->generateBufferObjects();
	greenCycle->memRotate(180.0f, 0.0f, 1.0f, 0.0f);
	greenCycle->memTranslate(2.0f, 0.0f, 0.0f);
	
	blueCycle = SceneNode::getRootSceneNode()->createChild(new BlueCycle());
	((BOEntity*)(blueCycle->data))->generateBufferObjects();
	blueCycle->memRotate(180.0f, 0.0f, 1.0f, 0.0f);
	blueCycle->memTranslate(3.0f, 0.0f, 0.0f);
	
	CollisionManager::add(new BoundingSphere(redCycle));
	CollisionManager::add(new BoundingSphere(greenCycle));
	CollisionManager::add(new BoundingSphere(blueCycle));
	
	float pos[3] = { 0.0f, 1.25f, -2.5f };
	camera = greenCycle->createChild(new Camera(pos));
	
	battleground = SceneNode::getRootSceneNode()->createChild(new Battleground());
	((BOEntity*)(battleground->data))->generateBufferObjects();
}